<#import "../tpl/pageTep.ftl" as page>
<@page.pageBase currentMenu="分销订单详情">
<style>
    .control-group p {
        margin: 1px 0 0 20px;
        float: left;
        font-size: 13px;
        text-align: left;
        line-height: 30px;
    }

    .order-details {
        width: 100%;
    }

    .order {
        width: 60%;
        float: left;
    }

    .panel-header {
        color: #333333;
        background-color: #f5f5f5;
        border-color: #dddddd;
    }

    .button-large {
        padding: 10px 30px;
        font-size: 16px;
    }

    #content {
        margin-top: 8px;
    }
</style>
<div class="xm-offline">
    <div class="row">
        <div class="panel">
            <div class="form-horizontal">
                <div class="panel-header">
                    <a onclick="window.history.go(-1)" >返回上一级</a>
                </div>
                <div class="panel-body">

                    <h3>订单详情</h3>
                    <hr>
                    <div class="order-details">
                        <div class="order">
                            <div class="control-group">
                                <label class="control-label">
                                    订单号：
                                </label>

                                <p>${e.orderID!}</p>
                            </div>
                            <div class="control-group">
                                <label class="control-label">
                                    订单时间：
                                </label>

                                <p>${e.createTime!}</p>
                            </div>
                            <div class="control-group">
                                <label class="control-label">
                                    买家帐号：
                                </label>

                                <p>${e.nickname!}</p>
                            </div>
                            <div class="control-group">
                                <label class="control-label">
                                    订单状态：
                                </label>

                                <p class="status-p"></p>
                            </div>
                            <div class="control-group">
                                <label class="control-label">
                                    买家留言：
                                </label>

                                <div class="controls control-row12" style="height: 180px;initialFrameWidth: 100%;">
                                    <textarea type="text" data-rules="{required:true}" class="input-large"
                                              id="content" style="height: 170px" disabled>${e.remark!}</textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="panel-body">
                    <h3>商品信息</h3>
                    <hr>
                    <div id="grid"></div>
                </div>
                <div class="panel-body">
                    <h3>物流信息</h3>
                    <hr>
                    <form id="detailForm" action="${basepath}/rest/manage/order/sendProduct" class="form-horizontal"
                          method="post">
                    <#--<input type="hidden" class="control-text span-width span8 hidden" name="addressID"
                           value="${e.addressID!}"/>-->
                    <#-- <input type="hidden" class="control-text span-width span8 hidden" name="id" value="${e.id!}"/>-->
                        <input type="hidden" class="control-text span-width span8 hidden" name="id"
                               value="${e.orderID!}"/>

                        <div class="control-group">
                            <label class="control-label">
                                <s>*</s>
                                收货人：
                            </label>

                            <div class="controls">
                                <#if e.name??>
                                    <input type="text" class="control-text span-width span8" value="${e.name!}"
                                           disabled/>
                                <#else>
                                    <input type="text" class="control-text span-width span8" value=""
                                           disabled/>
                                </#if>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">
                                <s>*</s>
                                收货地址：
                            </label>

                            <div class="controls">
                                <#if e.address??>
                                    <input type="text" class="control-text span-width span8"
                                           value="${e.province!}${e.address!}"
                                           disabled>
                                <#else>
                                    <input type="text" class="control-text span-width span8" value=""
                                           disabled>
                                </#if>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">
                                <s>*</s>
                                联系电话：
                            </label>

                            <div class="controls">
                                <input type="text" class="control-text span-width span8" value="${e.phone!}"
                                       disabled>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">
                                <s>*</s>
                                快递公司：
                            </label>

                            <div class="controls">
                                <input type="text" class="control-text span-width span8" name="expressCompany"
                                       value="${e.expressCompany!}"  disabled>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">
                                <s>*</s>
                                快递单号：
                            </label>

                            <div class="controls">
                                <input type="text" class="control-text span-width span8" name="expressNum"
                                       value="${e.expressNum!}" disabled>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">
                                <s>*</s>
                                发货人：
                            </label>

                            <div class="controls">
                                <input type="text" class="control-text span-width span8" name="consigner"
                                       value="${e.consigner!}" disabled>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    var Grid = BUI.Grid,
            Store = BUI.Data.Store,
            columns = [
                {title: '商品名称', dataIndex: 'productName', elCls: 'center', width: '20%'},
                {
                    title: '商品图片', dataIndex: 'picture', elCls: 'center', width: '20%', renderer: function (value) {
                    return '<img src="/' + value + '" style="width:110px;height:110px"/>';
                }
                },
                {title: '商品规格', dataIndex: 'specInfo', elCls: 'center', width: '20%'},
                {title: '下单数量', dataIndex: 'number', elCls: 'center', width: '20%'},
                {title: '商品单价', dataIndex: 'price', elCls: 'center', width: '20%'}
            ];

    var store = new Store({
                url: '/rest/manage/order/loadProduct',
                autoLoad: true, //自动加载数据
                params: { //配置初始请求的参数
                    length: '10',
                    orderID: '${e.orderID!}'
                },
                pageSize: 10,	// 配置分页数目
                root: 'list',
                totalProperty: 'total'
            }),
            grid = new Grid.Grid({
                render: '#grid',
                columns: columns,
                width: '100%',
                loadMask: true, //加载数据时显示屏蔽层
                store: store,
                plugins: [Grid.Plugins.CheckSelection], // 插件形式引入多选表格
                // 底部工具栏
                bbar: {
                    pagingBar: true
                }
            });
    grid.render();

    var form = new BUI.Form.Form({
        srcNode: '#detailForm'
    }).render();
    form.on('beforesubmit', function (ev) {
        if (!form.isValid()) {
            alert(1);
        }
    });
    //判断订单状态
    switch ("${e.status!}") {
        case "init":
            $(".status-p").text("待付款");
            break;
        case "pass":
            $(".status-p").text("待发货");
            break;
        case "send":
            $(".status-p").text("待收货");
            break;
        case "finish":
            $(".status-p").text("已完成");
            break;
        case "cancel":
            $(".status-p").text("已取消");
            break;
    }

</script>
</@page.pageBase>